<template>
  <div class="b-bar-box">
    <div class="title-box-bar">
      <span style="font-size: 0.07rem">{{ name }}</span>
      <div>
        <span class="value-span">{{ value }}</span>
        <span>座</span>
      </div>
    </div>
    <div class="bar-box-bottom">
      <div
        class="bar-percent"
        :style="{ background: color, width: (value / sum) * 100 + '%' }"
      ></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "BBar",

  props: {
    name: {
      type: String,
      default() {
        return "";
      },
    },
    value: {
      type: Number,
      default() {
        return 0;
      },
    },
    sum: {
      type: Number,
      default() {
        return {};
      },
    },
    // color: {
    //     type: String,
    //     default() {
    //         return {};
    //     },
    // },
  },

  data() {
    return {
      color: "linear-gradient(to right, #1F90FB, #18FDFF)",
      // percent: {
      //     background: "#CB95FB",
      //     width: "50%",
      // },
    };
  },
};
</script>

<style lang="scss" scoped>
.b-bar-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  .title-box-bar {
    height: 0.07rem;
    width: 80%;
    display: flex;
    justify-content: space-between;
    color: #fff;
    margin-bottom: 0.015rem;
    span {
      font-size: 0.07rem;
    }
    .value-span {
      margin-right: 0.05rem;
      font-size: 0.08rem;
      color: #00ffff;
    }
  }
  .bar-box-bottom {
    width: 80%;
    height: 0.02rem;
    border-radius: 4px;
    background: rgba(235, 235, 235, 0.36);
    .bar-percent {
      height: 0.02rem;
      border-radius: 4px;
    }
  }
}
</style>
